If you encounter this problem, write it out and share it with you.
This program does not use the javamail API, but directly processes the sent mail according to the requirements of the SMTP protocol. Although it is troublesome, it is helpful to understand the details of the mail protocol.
This article is divided into two parts, the first part is the SMTP command introduction (this is copied from somewhere else, hey); the second part is a real understa
Java has powerful network functions and is easy to develop and use. It is no wonder that microsoft strives to regain the dominant position of the programming language. According to the smtp protocol, java Socket is used to write a program for sending emails,The implementation principle is very simple. First, establish a Socket connection with the mail server, the
The operations of both programs are simple. These two programs are called VIRPRO01A and virpro01b, respectively, and correspond to program A and program B in the hypothetical scenario discussed above.
Program VIRPRO01A
The VIRPRO01A program is designed to take the POP3 e-mail server as a public
PHP email Regular expression validation, e-mail address regular expression
The most common verification we encounter is email address verification. Common on the site. Various Web page scripts are also commonly used "regular expressions" (regular expression) to verify the e-mail address we enter and determine whether it is legal. Some can also break down the use
Finally quit the process of sending e-mail. Note that response code 221, the leftmost 2 represents the success of the operation, the middle 2 represents the transmission channel, 1 means the connection is closed.
I have discussed the issue of annexes before. Attachments can also be sent via Smtpdemo. By sending the following command to the Mail Service program, you can add file.txt as an attachment in your message.
Helo digital.net
Mail from:ray
First, prefaceIn the background development process, the validation of parameters becomes an indispensable part of the development environment. For example, the parameter can not be null,email so must conform to the format of email, if manually make if judgment or write regular expression to judge the unintended development efficiency is too slow, in time, cost,
In the development of Java server-side code, we will encounter the external parameters of the validity of validation, and Hibernate-validator provides some common parameter check annotations, we can use.The hibernate-validator corresponding jar is introduced in 1.maven:2. Define the field to validate in the model (that is, the field cannot be empty and the maximum length is 14):
123456789101112
I have participated in the development of various Web applications and often encounter the need to embed mail functions into Web applications. For example, if it is an EC application, the customer will receive an order confirmation email after placing the order, and the commodity provider will receive an email to process the new order, in this way, the product provider does not have to regularly access its
This is a servlet application ..
The first is the Web. xml file.
The sendmail. jsp page is used to enter the content of the sent mail.
Next is the sendresult. jsp page used to display the mail sending result.
The core servlet of the email sending program
Package COM. jadyer. servlet;
During the test: Enter the details of the email you want to send on the s
Build your email program on the j2-based PlatformJacky PanTable of Contents1. Introduction to the tutorial and installation of Programs2. Program Structure3. Interface Design4. Account Management5. network connection between the MIDlet and Servlet6. Servlet and JavaMail7. simple XML8. Summary1. Introduction to the tutorial and installation of ProgramsThis tutoria
user name and password variable String user=null; String Password=null;Need to add a statement to set up authentication
The code is as follows
Copy Code
Props.put ("Mail.smtp.host", mailhost); Setting up an SMTP hostProps.put ("Mail.smtp.auth", "true"); Set authentication to TRUE, if authentication must be set to TRUE//Get mail Session ObjectSession = Session.getdefaultinstance (props,null) in code 1; ToSession = Session.getdefaultinstance (props, new Email_autherti
The effect is the same as that of the SMTP protocol in the previous two days. However, it is much more convenient and easier to use javamail.
To run this program, two Java packages are required: mail. jar and activation. Jar. These two packages are easy to run, so I will not talk about them here.
The core classes of javamail APIs used in this program include Sess
(Input.equals (code))//determine if the verification code is correct{Joptionpane.showmessagedialog (NULL, "Verification code is correct, verify success!" "," Results ", Joptionpane.plain_message); } Else{Joptionpane.showmessagedialog (NULL, "Verification code error, Verification failed!" "," Results ", Joptionpane.plain_message); } }}4. Results5. Experimental summaryThe key is to grasp the type conversion, there are a lot of methods to generate random strings, to examine the use of Ran
("failed to send! "); Return ERROR;} addActionMessage (" sent successfully! "); Return SUCCESS ;}}
2、mail.html portal page template
Iii. Test
Enter http: // localhost: 8080/jspgensdf/send. gen in the browser.
Note:163 the newly registered account cannot be sent. It seems that it takes two months to use it. You can build an email service environment and test it.
Java Web development
files from the Hibernate validator:Data validation is a feature that is used by any application, whether it is a display layer or a persistence layer. In general, the same check logic is scattered across layers, which not only wastes time but also causes duplicate code to occur. To avoid duplication, developers often write these check logic directly into the domain model, but this also mixes the domain model code with the checksum code, which should b
/technetwork/java/javamail/index.html.
After the download is complete, decompress the package to obtain the following directory:
Among them, mail. jar is the core development package necessary to develop the javamail program.
Demo subdirectory: Sample program.
Demo subdirectory: Sample program.
Lib subdirectory: This
When the user buys the goods, we should send a message to the user, tell him the order has been generated information, the email address is from the user's basic information to obtain, OK, first of all, let's look at the method of sending mail in Java.
1. How to send email in Java
Before perfecting this project, firs
Service certificate.
The Java program encountered an error while accessing the HTTPS resource Sun.security.validator.ValidatorException:PKIX path building failed: Sun.security.provider.certpath.SunCertPathBuilderException:unable to find valid certification path to requested Target this is essentially a certificate trust issue for Java when it accesses HTTPS
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.